*Analysis Do-File for creating Figures 3
	*Figures are separated in to 3a,b,c,d
*Runs event study regressions and produces graphs of effects over time

***File set-up
macro drop _all
mat drop _all
eststo clear
estimates clear
global path "[ENTER PATH HERE]"
global figs "$path\REStat Replication V2\Figures"
global log "$path\REStat Replication V2\Log Files"
set scheme lean2

clear
set more off

cap log close
log using "$log\figure_3.txt", replace text
use "$path\REStat Replication V2\Data\master_data_analysis_subset"

*Set folder for main figures
cd "$figs"



***Loops through arrest types, producing the estimates that go into Figure 3
foreach var of varlist murder_tot agg_assault_tot burglary_tot theft_tot {
	
	*Since all arrests are part 1 offenses, ensure that crime data is non-missing
		di "------Reg `var' arrests------"
		reghdfe ln_`var' ln_pop_s ///
			qtr_neg4_binned-qtr_neg2  qtr_0-qtr_6_binned ///
			if !inlist(., ln_actual_`var', ln_actual_index_violent, ln_actual_index_property) ///
			, cl(group_ori) absorb(group_ori month_year)
			
		*Call plot code
		qui do "$path\REStat Replication\Code\coef_plot_quart"
			
		*Plot the normalized coefficents and SEs
		*Normalized to the quarter right before officer-involved fatality
		qui coefplot mat(coef_1000[,1]), vertical yline(0) se(2)  /// 
			yscale(range(-0.5 0.1))  ylabel(-0.5(0.1)0.1, glcolor(gs12)) ///
			msize(large) msymbol(O) mfcolor(black%100) mcolor(white%0) ///
			xtitle(Quarter Relative to Event) ytitle(Log Points) ///
			xline(3.5, lpattern(dash) lcolor(red) axis(1))
		if "`var'" == "murder_tot" {
			graph export "figure_3a.pdf", replace
		}
		else if "`var'" == "agg_assault_tot" {
			graph export "figure_3b.pdf", replace
		}
		else if "`var'" == "burglary_tot" {
			graph export "figure_3c.pdf", replace			
		}
		else if "`var'" == "theft_tot" {
			graph export "figure_3d.pdf", replace			
		}
}


cap log close

